Now let's add our cabins to our lots with code.
And I'm going to use the cabin from the last video.
So if we go to our toolbox, I'm under the home tab toolbox.
That's the cabin boom.
There we go.
And I'll close the toolbox.
I'm going to change the orientation of my cabin.
Cool.
And then I'm going to center it a little bit more.
Not going to make it perfect.
You could you could change this depending if you want more of a front yard, back yard, you might want
a garage or something.
You may need to make your lots bigger.
That looks pretty good.
Let's add a part to our cab and that's going to be the anchor part.
It's also going to be the primary part to the model.
Let's just hit this plus sign here.
Hit a P for part.
There we go.
That's going to be our anchor part.
Let's call that part.
It's inside the cabin.
Inside the cabin model.
So I'm going to call this cabin anchor because we have a lot of anchors floating around.
Now.
We know the front is pointing to the left from past experience.
But just in case you don't know, hit the plus sign, add a decal.
It'll default to the front face front, and you can't really see them that well anymore.
I think that update just happened today.
But if you hover your mouse over it, you can see it.
Nice.
Now let's rotate our part.
So get your cabin anchor, get the rotate, and I have it on 15 degree increments.
Boom, boom, boom.
So that's facing front.
There's the decal.
Nice.
All right.
On my cabin anchor, I'm going to make it invisible.
So I'm going to go to transparency and the properties.
I'm going to hit one.
So it's invisible.
I'm going to go down to Can Collide.
I'm going to turn that off and anchored.
I'm going to turn that on now.
I'm going to position my cabin anchor over my lot anchor.
So.
I need to get the position of my lot.
Anchor And we have a couple lots, so we don't want to get the wrong one if I open up lots.
Oh man, we got three of them.
We could delete them or I could just go ahead and hit the alt key and then click on the lot part.
And that's going to select the lot of my player lot, the lot, part of my player lot.
Here's the anchor I want.
I can see it light up inside there.
I'm going to go to the position of the anchor and I'm going to scroll up.
See frame possession.
Let's go ahead and get that click, click there on the position.
Do A control C to copy it.
We're going to go up to our cabin anchor and then on the C frame position of the cabin anchor, let's
go ahead and whoops, can I get it?
Control V Oh man, let's go ahead and do a delete and then control.
V All right, nice.
Now it's in place.
Now I got to get the cabin.
Primary part select to the right there and then click cabin anchor.
Let's go ahead and move our cabin down to server storage.
Cabin server storage.
Oops, I got it in the starter Gooey.
Server storage.
There we go.
Should be right beside the fence.
Let's go to our server script service.
Open that up property test.
Cool.
And we're going to use this code when we do the purchasing and placing so it's not wasted.
We might do some cutting and pasting.
Let's get a reference for our cabin and this is going to be the original.
So I'm going to call this cabin temp for cabin template.
We're going to clone this and we'll do a server storage, wait for Child Cabin.
There we go.
All right.
So like the fence, we are going to clone the cabin.
So we'll say local.
Cabin from the cabin temp.
There we go.
Clone it.
The fence parent is going to be the lot.
We're going to make the cabin parent.
The lot also cool.
Now the anchor is for the lot anchor.
So we keep it like that.
Oh, and I looked up, get pivot.
It does return a key frame so you don't have to worry about positioning it.
So it's very similar to the old way of doing the set primary part key frame a little bit easier, but
it's new, so it might throw you off a little bit.
The pivot is for the anchor of the lot.
Let's get our cabin and we'll do a pivot too, which sets the primary part C frame to the anchor part.
And that's our cabin anchor to the lot Anchor.
So there we go.
Oh, should we put like a little a weight in for effect?
Maybe a weight one here?
Yeah.
One weight statement is good enough.
Let's go ahead and hit the play button, see what we got.
All right, In a few seconds, we should start getting some houses.
House and fence.
All right.
Looking good.
It is oriented properly.
It is positioned properly.
Now, when we buy stuff, we can put the houses and the fences where we want them with code.
I will see you in the next video and we will continue onward with that.